package com.durian.system.kafka;

/**
 * @Author zhouzhiyi
 * @Date 2022/6/18 23:20
 * @Description 日志kafka消费者监听器
 */
//@Component
public class LogKafkaConsumerListener {

//    private static final Logger log = LoggerFactory.getLogger(LogKafkaConsumerListener.class);
//
//    @Autowired
//    private RedisService redisService;
//
//    @Autowired
//    private RemoteLogService remoteLogService;
//
////    @KafkaListener(topics = "SysLogTopic")
//    public void onMessage(ConsumerRecord<String, String> data, Acknowledgment ack) {
//
//        String key = data.key();
//        String value = data.value();
//
//        if (StringUtils.hasText(key)){
//
//            if (redisService.setNotCacheObject(key,"",1L, TimeUnit.MINUTES)){
//
//                if (key.startsWith("SaveSysLog")){// 如果为保存系统日志
//
//                    // 远程调用添加到数据库
//                    log.info("添加日志为：{}", JSON.parseObject(value, SysOperLog.class));
//                    remoteLogService.saveLog(JSON.parseObject(value, SysOperLog.class), SecurityConstants.INNER);
//                }
//            }
//        }
//
//        ack.acknowledge();
//    }
}
